<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        /* logo */
        .logo {
            width: 100%;
            display: flex;
            justify-content: center;
            padding: 30px 0 0 0;
        }

        /* 表单 */
        .input_div {
            border-bottom: 1px solid #b5b5b5;
            width: 81%;
            margin: 10px auto;
            display: flex;
            align-items: center;
            padding-bottom: 10px;
        }

        .input_div img {
            margin-right: 5px;
            width: 25px;
        }

        input {
            background: none;
            border: none;
            padding: 10px 0;
            color: #ffffff;
            outline: none;
        }

        .check_div {
            width: 80%;
            margin: 10px auto;
            display: flex;
            align-items: center;
            padding-bottom: 10px;
            color: #999;
            font-size: 14px;
        }

        .check_div span {
            padding-left: 10px;
        }

        button {
            width: 80%;
            padding: 10px 0;
            border: none;
            border-radius: 100px;
            color: white;
            background-image: linear-gradient(90deg,
                #d0b56e 0%,
                #f7f095 100%),
                linear-gradient(#efbf4a,
                #efbf4a);
            background-blend-mode: normal,
                normal;
        }

        /* 底部图片 */
        .bottom_img {
            position: absolute;
            bottom: 0;
            z-index: -10;
        }
    </style>
</head>

<body style="background-color:black">
    <!-- logo -->
    <div class="logo">
        <img src="images/logo.png" style="width: 100px;height: 100px;">
    </div>
    <!-- 表单 -->
        <form method="get" action="javascript:;" class="form-horizontal" style="margin-top: 30px">
        <!-- 用户名 -->
        <div class="input_div">
            <img src="images/zhuce_03.png" alt="">
            <input type="text" placeholder="请填写用户名" name="nickname">
        </div>
        <!-- 密码 -->
        <div class="input_div">
            <img src="images/zhuce_09.png" alt="">
            <input type="password" placeholder="请填写登录密码" name="login_pwd">
        </div>
        <!-- 确认密码 -->
        <div class="input_div">
            <img src="images/zhuce_09.png" alt="">
            <input type="password" placeholder="请再次填写登录密码" name="login_pwds">
        </div>

        <!-- 手机号 -->
        <div class="input_div">
            <img src="images/zhuce_11.png" alt="">
            <input type="text" placeholder="请输入常用手机号"  name="phone">
        </div>
        <!-- 验证码 -->
        <div class="input_div">
            <img src="images/zhuce_13.png" alt="">
            <input type="text" placeholder="请填写验证码" style="width: 200px">
            <span style="color:#999" class="sms" onclick="sms(this)">获取验证码</span>
        </div>
        <!-- 推荐人 -->
        <div class="input_div">
            <img src="images/zhuce_16.png" alt="">
            <input type="text" placeholder="请填写推荐人的UID" name="code" readonly>
        </div>
        <!-- 注册说明 -->
        <div class="check_div">
            <input type="checkbox" class="shuoming" checked="">
            <span>我已阅读并同意《用户注册使用协议》</span>
        </div>
        <!-- 注册 -->
        <div style="margin-top:50px;text-align: center;">
            <button class="btn btn-primary" type="submit" onclick="add()">注册</button>
        </div>
    </form>
    <!-- 底部图片 -->
    <!-- <img src="images/6_03.png" class="bottom_img"> -->
</body>
{block name="javascript"}
<script src="http://xst.nowdoing.com.cn/public/admin/js/jquery.min.js?v=2.1.4"></script>
<script type="text/javascript">
  	$(function(){ 
      var obj=window.location.search;
      var index=obj.lastIndexOf("=");
    	obj=obj.substring(index+1,obj.length);
      $("[name='code']").val(obj);
    }); 
    var wait=60;
    function sms(obj) {
        var phone = $("[name=phone]").val();
        var url="/index.php/api/Login/sends";
      $.post(url,{phone:phone},function (res) {
        alert(res.message);	
            if(res.code==1){
                time(obj);
            }
        },"json")
     
    }
    function time(o) {
        //alert(1);
        if (wait == 0) {
            o.removeAttribute("disabled");
            // o.value="获取验证码";
            $(".sms").text("获取验证码");
            wait = 60;
        } else {

            o.setAttribute("disabled", true);
            $(".sms").text("重新发送(" + wait + ")");
            // o.value="重新发送(" + wait + ")";
            wait--;
            setTimeout(function() {
                    time(o)
                },
                1000)
        }
    }
   //document.getElementById("btn").onclick=function(){time(this);}
</script>
<script>
    function add()
    {
        var formData = new FormData();
        var nickname = $("[name='nickname']").val();
        var login_pwd = $("[name='login_pwd']").val();
        var login_pwds = $("[name='login_pwds']").val();
        var phone = $("[name='phone']").val();
        var smcode = $("[name='smcode']").val();
        var code = $("[name='code']").val();
        if(nickname=='')
        {
            alert('用户名不能为空');
            return false;
        }
        if(login_pwd=='')
        {
            alert('密码不能为空');
            return false;
        }
        if(login_pwds=='')
        {
            alert('重复密码不能为空');
            return false;
        }
        if(phone=='')
        {
            alert('手机号不能为空');
            return false;
        }
        if(smcode=='')
        {
            alert('验证码不能为空');
            return false;
        }
        if(code=='')
        {
            alert('推荐人UID不能够为空');
            return false;
        }
        if(!$(".shuoming").prop("checked")){
            alert('请选择用户使用协议');
            return false;
        }


        formData.append("nickname",nickname);
        formData.append("login_pwd", login_pwd);
        formData.append("login_pwds",login_pwds);
        formData.append("phone",phone);
        formData.append("smcode",smcode);
        formData.append("code",code);
        var url = 'http://xst.nowdoing.com.cn/index.php/api/Login/registerd';
        //var loading = alert('正在提交数据，请稍后...', {icon: 16,time:6000});
        $.ajax({
            type:'post',
            url:url,
            data:formData,
            contentType: false,
            processData: false,
          	dataType:"json",
            success:function(data){
               // layer.close(loading);
              alert(data.message);
                if(data.code==1){
                    setTimeout(function(){window.location.href="https://copy.im/a/T4e6eg";},1000);
                }
            }
        })
    }
    $("#backs").click(function(){
        //var index = parent.layer.getFrameIndex(window.name);
      //  parent.layer.close(index);
    })

</script>
{/block}
</html>